
/**
 * Copyright 2009 cestum.org
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
 
package org.waveprotocol.wave.model.id {
public interface PercentEncoderDecoder {
	/**
	 * Returns a string where all characters are encoded by converting it into
	 * its UTF-8 encoding and then encoding each of the resulting bytes as a
	 * %xx hexadecimal escape sequence.
	 *
	 * The encoding of the following chars are optional
	 *
	 * ":" / "@" / "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "=" /
	 * ALPHA / DIGIT / "-" / "." / "_" / "~"
	 */
	function encode(decodedValue:String):String;
	
	/**
	 * Returns a string where all percent encoded sequences have been converted back
	 * to their original character representations. The charset is UTF-8.
	 * Note, '+' should not be decoded as a space like in URL.
	 *
	 */
	function decode(encodedValue:String):String;
}
}